package com.pr.makfilm.dao.impl;

import com.pr.makfilm.dao.IRoomPlaceDao;
import com.pr.makfilm.domain.Room;
import com.pr.makfilm.domain.RoomPlace;
import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: Pawel
 * Date: 17.09.13
 * Time: 23:03
 * To change this template use File | Settings | File Templates.
 */
@Repository(RoomPlaceDaoImpl.BEAN_NAME)
public class RoomPlaceDaoImpl extends AbstractDaoImpl<RoomPlace> implements IRoomPlaceDao
{
   public static final String BEAN_NAME = "roomPlaceDao";

   @Override
   public List<RoomPlace> getByRoom(Room room)
   {
      Criteria criteria = createCriteria();
      criteria.add(Restrictions.eq(RoomPlace.FIELD_ROOM, room));
      return criteria.list();
   }
}
